package com.mydesign.demo.controller;


import com.mydesign.demo.bean.Store;
import com.mydesign.demo.bean.StoreToAssignment;
import com.mydesign.demo.model.ReturnResult;
import com.mydesign.demo.service.Impl.StoreServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("store")
public class StoreController {
    @Autowired
    private StoreServiceImpl storeService;
    //小店列表
    @GetMapping("StoreList")
    public ReturnResult StoreList(HttpServletRequest request){
        return storeService.StoreList(request);
    }
    //添加小店
    @PostMapping("AddStore")
    public ReturnResult AddStore(@RequestBody Store store){
       return storeService.AddStore(store);
    }
    //更新小店
    @PostMapping("updateStore")
    public ReturnResult updateStore(@RequestBody Store store){
        return storeService.updateStore(store);
    }
    //查询小店
    @GetMapping("SelectStoreDetail")
    public ReturnResult SelectStoreDetail(HttpServletRequest request){
        return storeService.SelectStoreDetail(request);
    }
    //指派小店订单
    @PostMapping("OrderStore")
    public ReturnResult OrderStore(@RequestBody StoreToAssignment assignment){
        return storeService.OrderStore(assignment);
    }
    //获取当前订单号
    @GetMapping("getUserCurrentOrder")
    public ReturnResult getUserCurrentOrder(HttpServletRequest request){
        return storeService.getUserCurrentOrder(request);
    }
    @GetMapping("collect")
    public ReturnResult collect(HttpServletRequest request){
        return storeService.collect(request);
    }
    @GetMapping("getcollect")
    public ReturnResult getcollect(HttpServletRequest request){
        return storeService.getcollect(request);
    }
}
